package com.ssy.lingxi.logistics.controller.feign;

import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.logistics.api.dto.request.LogisticsMemberIdAndRoleIdReq;
import com.ssy.lingxi.logistics.api.dto.request.LogisticsSelectCompanyListFeignReq;
import com.ssy.lingxi.logistics.api.dto.response.CommonSelectResponse;
import com.ssy.lingxi.logistics.api.dto.response.FreightTemplateFeignRes;
import com.ssy.lingxi.logistics.api.dto.response.ShipperAddressSelectFeignRes;
import com.ssy.lingxi.logistics.service.ILogisticsSelectFeignService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
 * 内部feign接口 - 物流能力 - 下拉框
 * @author wyx
 * @version 2.0.0
 * @date 2022-03-29
 **/
@RestController
@RequestMapping("/logistics/select/feign")
public class LogisticsSelectFeignController {
    @Resource
    private ILogisticsSelectFeignService logisticsSelectFeignService;


    /**
     * 能力中心 - 运费模板下拉框
     * @return 返回结果
     */
    @PostMapping(value = "/listFreightTemplate")
    Wrapper<List<FreightTemplateFeignRes>> listFreightTemplate(@RequestBody @Valid LogisticsMemberIdAndRoleIdReq req) {
        return logisticsSelectFeignService.listFreightTemplate(req);
    }

    /**
     * 发货地址查询全部(按照是否默认排序)
     * @return 返回结果
     */
    @PostMapping(value = "/listShipperAddress")
    Wrapper<List<ShipperAddressSelectFeignRes>> listShipperAddress(@RequestBody @Valid LogisticsMemberIdAndRoleIdReq req) {
        return logisticsSelectFeignService.listShipperAddress(req);
    }

    /**
     * 物流公司查询全部(不同合作类型)
     * @param req 接口参数
     * @return 返回结果
     */
    @PostMapping(value = "/listCompany")
    Wrapper<List<CommonSelectResponse>> listCompany(@RequestBody @Valid LogisticsSelectCompanyListFeignReq req) {
        return logisticsSelectFeignService.listCompany(req);
    }
}
